#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
import os


def myprint(obj, end='\n'):
    sys.stdout.write(str(obj) + end)


def main():
    '''
    删除dir2目录下跟dir1目录下同名的文件
    '''

    dir1 = r'd:/data/zj'
    dir2 = r'd:/data/all'

    dir1files = os.listdir(dir1)
    dir2files = os.listdir(dir2)

    # myprint('dir1files:%s' % '|'.join(dir1files))
    # myprint('dir2files:%s' % '|'.join(dir2files))

    os.chdir(r'd:/data/all')
    myprint(os.getcwd())
    for f in dir1files:
        if os.path.isfile(f):
            os.remove(f)


if __name__ == '__main__':
    main()
    myprint('done')
